package com.logic.landseaserver.ws.dto;

import java.sql.Timestamp;
import java.util.Date;
import java.util.List;

import com.logic.common.ws.dto.system.FileDTO;
import com.logic.landseaserver.common.LandeaConstants;
import com.logic.landseaserver.domain.CustomerCard;
import com.logic.landseaserver.domain.Deposit;

import com.logic.landseaserver.models.authcode.bean.UsedAuthCode;
import io.swagger.annotations.ApiModelProperty;

public class DepositDTO {

    private Integer id;

    private String depositSn;

    private String certificatesType;

    private String certificatesId;

    private String userName;

    private String cellPhone;

    private String nameAndPhone;

    private Integer prjId;

    private String desoStyle;

    private String desoStyleName;

    private Integer roomId;

    private String lease;

    private String leaseName;

    private String paymentMode;

    private Date orderDate;

    private Date availableDate;

    private Double depositAmount;

    private String status;

    private String payMethod;

    private Date payDate;

    private String paySn;

    private String comments;

    private Integer version;

    private Date createdDtm;

    private Integer createdBy;

    private Date lastModifiedDtm;

    private Integer lastModifiedBy;

    private Integer deleted;

    private String statusName;

    private String paymentModeName;

    private String payMethodName;

    private String certificatesTypeName;

    private String prjName;

    private String roomNo;

    private String imageId;

    private String bank;

    private String orderNo;

    private Integer pdfId;

    private String imagePath;

    private String city;

    private Integer userId;

    private String verifyCode;

    private String desoStyleNameRoomNo;//房间风格|房间号

    private Date nowTime;

    private FileDTO pdf;

    private String gender;

    private String address;

    @ApiModelProperty(value = "是否从前端进入", position = 1)
    private Boolean frontFlag;

    private Integer pdfImg;
    private FileDTO image;

    private Boolean isChapter;

    private String createUser;

    private Boolean hasEnd;

    private String roomAppendStatus;

    private Boolean applyRefund;

    private Integer applyRefundNum;

    private Double originalAmount;

    private Double discountAmount;

    private List<UsedAuthCode> authCodes;//新增时

    private List<QueryCouponUesdDTO> queryAuthCodes;//查询时

    private Double originalDeposit;

    private Boolean latestVersion;

    private List<UserFileDTO> historyFiles;

    @ApiModelProperty(value = "账户名", position = 1)
    private String cardAccount;
    @ApiModelProperty(value = "持卡人姓名", position = 1)
    private String cardUserName;
    @ApiModelProperty(value = "开户行", position = 1)
    private String bankName;
    @ApiModelProperty(value = "开户行支行", position = 1)
    private String bankBrname;
    @ApiModelProperty(value = "银行卡卡号", position = 1)
    private String cardNo;
    @ApiModelProperty(value = "银行卡联系人号码", position = 1)
    private String cardCellPhone;
    //用户查询
    private CustomerCardDTO customerCardDTO;


    public String getRoomAppendStatus() {
        return roomAppendStatus;
    }

    public void setRoomAppendStatus(String roomAppendStatus) {
        this.roomAppendStatus = roomAppendStatus;
    }

    public String getDesoStyleNameRoomNo() {
        return desoStyleNameRoomNo;
    }

    public Boolean getFrontFlag() {
        return frontFlag;
    }

    public void setFrontFlag(Boolean frontFlag) {
        this.frontFlag = frontFlag;
    }

    public void setDesoStyleNameRoomNo(String desoStyleNameRoomNo) {
        this.desoStyleNameRoomNo = desoStyleNameRoomNo;
    }

    public Boolean getHasEnd() {
        return hasEnd;
    }

    public void setHasEnd(Boolean hasEnd) {
        this.hasEnd = hasEnd;
    }

    public String getCity() {
        return city;
    }

    public String getVerifyCode() {
        return verifyCode;
    }

    public void setVerifyCode(String verifyCode) {
        this.verifyCode = verifyCode;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getImagePath() {
        return imagePath;
    }

    public void setImagePath(String imagePath) {
        this.imagePath = imagePath;
    }

    public Integer getPdfId() {
        return pdfId;
    }

    public void setPdfId(Integer pdfId) {
        this.pdfId = pdfId;
    }

    public String getImageId() {
        return imageId;
    }

    public void setImageId(String imageId) {
        this.imageId = imageId;
    }

    public String getBank() {
        return bank;
    }

    public void setBank(String bank) {
        this.bank = bank;
    }

    public String getCertificatesTypeName() {
        return certificatesTypeName;
    }

    public void setCertificatesTypeName(String certificatesTypeName) {
        this.certificatesTypeName = certificatesTypeName;
    }

    public String getPrjName() {
        return prjName;
    }

    public void setPrjName(String prjName) {
        this.prjName = prjName;
    }

    public String getRoomNo() {
        return roomNo;
    }

    public void setRoomNo(String roomNo) {
        this.roomNo = roomNo;
    }

    public String getNameAndPhone() {
        return nameAndPhone;
    }

    public void setNameAndPhone(String nameAndPhone) {
        this.nameAndPhone = nameAndPhone;
    }

    public String getStatusName() {
        return statusName;
    }

    public void setStatusName(String statusName) {
        this.statusName = statusName;
    }

    public String getPaymentModeName() {
        return paymentModeName;
    }

    public void setPaymentModeName(String paymentModeName) {
        this.paymentModeName = paymentModeName;
    }

    public String getPayMethodName() {
        return payMethodName;
    }

    public void setPayMethodName(String payMethodName) {
        this.payMethodName = payMethodName;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDepositSn() {
        return depositSn;
    }

    public void setDepositSn(String depositSn) {
        this.depositSn = depositSn == null ? null : depositSn.trim();
    }

    public String getCertificatesType() {
        return certificatesType;
    }

    public void setCertificatesType(String certificatesType) {
        this.certificatesType = certificatesType == null ? null : certificatesType.trim();
    }

    public String getCertificatesId() {
        return certificatesId;
    }

    public void setCertificatesId(String certificatesId) {
        this.certificatesId = certificatesId == null ? null : certificatesId.trim();
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName == null ? null : userName.trim();
    }

    public String getCellPhone() {
        return cellPhone;
    }

    public void setCellPhone(String cellPhone) {
        this.cellPhone = cellPhone == null ? null : cellPhone.trim();
    }

    public Integer getPrjId() {
        return prjId;
    }

    public void setPrjId(Integer prjId) {
        this.prjId = prjId;
    }

    public String getDesoStyle() {
        return desoStyle;
    }

    public void setDesoStyle(String desoStyle) {
        this.desoStyle = desoStyle == null ? null : desoStyle.trim();
    }

    public Integer getRoomId() {
        return roomId;
    }

    public void setRoomId(Integer roomId) {
        this.roomId = roomId;
    }

    public String getLease() {
        return lease;
    }

    public void setLease(String lease) {
        this.lease = lease == null ? null : lease.trim();
    }

    public String getPaymentMode() {
        return paymentMode;
    }

    public void setPaymentMode(String paymentMode) {
        this.paymentMode = paymentMode == null ? null : paymentMode.trim();
    }

    public Date getOrderDate() {
        return orderDate;
    }

    public void setOrderDate(Date orderDate) {
        this.orderDate = orderDate;
    }

    public Date getAvailableDate() {
        return availableDate;
    }

    public void setAvailableDate(Date availableDate) {
        this.availableDate = availableDate;
    }

    public Double getDepositAmount() {
        return depositAmount;
    }

    public void setDepositAmount(Double depositAmount) {
        this.depositAmount = depositAmount;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status == null ? null : status.trim();
    }

    public String getPayMethod() {
        return payMethod;
    }

    public void setPayMethod(String payMethod) {
        this.payMethod = payMethod == null ? null : payMethod.trim();
    }

    public Date getPayDate() {
        return payDate;
    }

    public void setPayDate(Date payDate) {
        this.payDate = payDate;
    }

    public String getPaySn() {
        return paySn;
    }

    public void setPaySn(String paySn) {
        this.paySn = paySn == null ? null : paySn.trim();
    }

    public String getComments() {
        return comments;
    }

    public void setComments(String comments) {
        this.comments = comments == null ? null : comments.trim();
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public Date getCreatedDtm() {
        return createdDtm;
    }

    public void setCreatedDtm(Date createdDtm) {
        this.createdDtm = createdDtm;
    }

    public Integer getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(Integer createdBy) {
        this.createdBy = createdBy;
    }

    public Date getLastModifiedDtm() {
        return lastModifiedDtm;
    }

    public void setLastModifiedDtm(Date lastModifiedDtm) {
        this.lastModifiedDtm = lastModifiedDtm;
    }

    public Integer getLastModifiedBy() {
        return lastModifiedBy;
    }

    public void setLastModifiedBy(Integer lastModifiedBy) {
        this.lastModifiedBy = lastModifiedBy;
    }

    public Integer getDeleted() {
        return deleted;
    }

    public void setDeleted(Integer deleted) {
        this.deleted = deleted;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getDesoStyleName() {
        return desoStyleName;
    }

    public void setDesoStyleName(String desoStyleName) {
        this.desoStyleName = desoStyleName;
    }

    public String getLeaseName() {
        return leaseName;
    }

    public void setLeaseName(String leaseName) {
        this.leaseName = leaseName;
    }

    public Date getNowTime() {
        return nowTime;
    }

    public void setNowTime(Date nowTime) {
        this.nowTime = nowTime;
    }

    public FileDTO getPdf() {
        return pdf;
    }

    public void setPdf(FileDTO pdf) {
        this.pdf = pdf;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public Boolean getChapter() {
        return isChapter;
    }

    public void setChapter(Boolean chapter) {
        isChapter = chapter;
    }

    public static Deposit convertToDeposit(DepositDTO dto) {
        Deposit pojo = new Deposit();
        pojo.setId(dto.getId() == null ? null : dto.getId());
        pojo.setUserId(dto.getUserId());
        pojo.setCity(dto.getCity());
        pojo.setDepositSn(dto.getDepositSn() == null ? null : dto.getDepositSn());
       // pojo.setCertificatesType(dto.getCertificatesType() == null ? null : dto.getCertificatesType());
       // pojo.setCertificatesId(dto.getCertificatesId() == null ? null : dto.getCertificatesId());
      //  pojo.setUserName(dto.getUserName() == null ? null : dto.getUserName());
     //   pojo.setCellPhone(dto.getCellPhone() == null ? null : dto.getCellPhone());
        pojo.setPrjId(dto.getPrjId() == null ? null : dto.getPrjId());
        pojo.setDesoStyle(dto.getDesoStyle() == null ? null : dto.getDesoStyle());
        pojo.setRoomId(dto.getRoomId() == null ? null : dto.getRoomId());
        pojo.setLease(dto.getLease() == null ? null : dto.getLease());
        pojo.setPaymentMode(dto.getPaymentMode() == null ? null : dto.getPaymentMode());
        pojo.setAvailableDate(dto.getAvailableDate() == null ? null : dto.getAvailableDate());
        pojo.setDepositAmount(dto.getDepositAmount() == null ? null : dto.getDepositAmount());
        pojo.setStatus(dto.getStatus() == null ? null : dto.getStatus());
        pojo.setPayMethod(dto.getPayMethod() == null ? null : dto.getPayMethod());
        pojo.setPayDate(dto.getPayDate() == null ? null : dto.getPayDate());
        pojo.setPaySn(dto.getPaySn() == null ? null : dto.getPaySn());
        pojo.setComments(dto.getComments() == null ? null : dto.getComments());
        pojo.setBank(dto.getBank() == null ? null : dto.getBank());
        pojo.setImageId(dto.getImageId() == null ? null : dto.getImageId());
        pojo.setPdfId(dto.getPdfId() == null ? null : dto.getPdfId());
        pojo.setOrderNo(dto.getOrderNo() == null ? null : dto.getOrderNo());
        pojo.setCity(dto.getCity() == null ? null : dto.getCity());
      //  pojo.setGender(dto.getGender() == null ? null : dto.getGender());
      //  pojo.setAddress(dto.getAddress() == null ? null : dto.getAddress());
        pojo.setPdfImg(dto.getPdfImg() == null ? null : dto.getPdfImg());
        pojo.setChapter(dto.getIsChapter() == null ? null : dto.getIsChapter());
        pojo.setDiscountAmount(dto.getDiscountAmount()== null ? 0 : dto.getDiscountAmount());
        pojo.setOriginalAmount(dto.getOriginalAmount()== null ? 0 : dto.getOriginalAmount());
        pojo.setOriginalDeposit(dto.getOriginalDeposit()== null ? 0 : dto.getOriginalDeposit());
        return pojo;
    }

    public static DepositPdfDTO convertToDepositPdfDTO(DepositDTO depositDTO) {
        DepositPdfDTO dto = new DepositPdfDTO();
        dto.setId(depositDTO.getId() == null ? null : depositDTO.getId());
        dto.setDepositSn(depositDTO.getDepositSn() == null ? null : depositDTO.getDepositSn());
        dto.setCertificatesType(depositDTO.getCertificatesType() == null ? null : depositDTO.getCertificatesType());
        dto.setCertificatesId(depositDTO.getCertificatesId() == null ? null : depositDTO.getCertificatesId());
        dto.setUserName(depositDTO.getUserName() == null ? null : depositDTO.getUserName());
        dto.setCellPhone(depositDTO.getCellPhone() == null ? null : depositDTO.getCellPhone());
        dto.setPrjId(depositDTO.getPrjId() == null ? null : depositDTO.getPrjId());
        dto.setDesoStyle(depositDTO.getDesoStyle() == null ? null : depositDTO.getDesoStyle());
        dto.setRoomId(depositDTO.getRoomId() == null ? null : depositDTO.getRoomId());
        dto.setLease(depositDTO.getLease() == null ? null : depositDTO.getLease());
        dto.setPaymentMode(depositDTO.getPaymentMode() == null ? null : depositDTO.getPaymentMode());
        dto.setAvailableDate(depositDTO.getAvailableDate() == null ? null : depositDTO.getAvailableDate());
        dto.setDepositAmount(depositDTO.getDepositAmount() == null ? null : depositDTO.getDepositAmount());
        dto.setStatus(depositDTO.getStatus() == null ? null : depositDTO.getStatus());
        dto.setPayMethod(depositDTO.getPayMethod() == null ? null : depositDTO.getPayMethod());
        dto.setComments(depositDTO.getComments() == null ? null : depositDTO.getComments());
        dto.setPdfId(depositDTO.getPdfId() == null ? null : depositDTO.getPdfId());
        dto.setGender(depositDTO.getGender() == null ? null : depositDTO.getGender());
        dto.setCustomerAddress(depositDTO.getAddress() == null ? null : depositDTO.getAddress());
        dto.setPdfImg(depositDTO.getPdfImg() == null ? null : depositDTO.getPdfImg());
        dto.setDiscountAmount(depositDTO.getDiscountAmount()==null ? 0 : depositDTO.getDiscountAmount());
        dto.setOriginalAmount(depositDTO.getOriginalAmount()==null ? 0 : depositDTO.getOriginalAmount());
        return dto;
    }

    public Boolean getApplyRefund() {
        return applyRefund;
    }

    public void setApplyRefund(Boolean applyRefund) {
        this.applyRefund = applyRefund;
    }

    public Integer getApplyRefundNum() {
        return applyRefundNum;
    }

    public void setApplyRefundNum(Integer applyRefundNum) {
        this.applyRefundNum = applyRefundNum;
    }
    public void updateCommonInfo(Integer userId) {

        Timestamp now = new Timestamp(new Date().getTime());
        if (this.getId() == null || this.getId() == 0) { // New PoJo
            this.setVersion(0);
            if (this.getCreatedDtm() == null) {
                this.setCreatedDtm(now);
            }
            if (this.getCreatedBy() == null || this.getCreatedBy().equals(0)) {
                this.setCreatedBy(userId == null ? 0 : userId);
            }
            this.setLastModifiedDtm(now);
            this.setLastModifiedBy(userId == null ? 0 : userId);
            this.setDeleted(0);

        } else { // Update this
            this.setVersion(this.getVersion() == null ? 1 : this.getVersion() + 1);
            this.setLastModifiedDtm(now);
            if (userId.equals(-1)) {
            } else {
                this.setLastModifiedBy(userId == null ? 0 : userId);
            }
        }
    }

    public Integer getPdfImg() {
        return pdfImg;
    }

    public void setPdfImg(Integer pdfImg) {
        this.pdfImg = pdfImg;
    }

    public FileDTO getImage() {
        return image;
    }

    public void setImage(FileDTO image) {
        this.image = image;
    }

    public Boolean getIsChapter() {
        return isChapter;
    }

    public void setIsChapter(Boolean isChapter) {
        this.isChapter = isChapter;
    }

    public Double getOriginalAmount() {
        return originalAmount;
    }

    public void setOriginalAmount(Double originalAmount) {
        this.originalAmount = originalAmount;
    }

    public Double getDiscountAmount() {
        return discountAmount;
    }

    public void setDiscountAmount(Double discountAmount) {
        this.discountAmount = discountAmount;
    }

    public List<UsedAuthCode> getAuthCodes() {
        return authCodes;
    }

    public void setAuthCodes(List<UsedAuthCode> authCodes) {
        this.authCodes = authCodes;
    }

    public Double getOriginalDeposit() {
        return originalDeposit;
    }

    public void setOriginalDeposit(Double originalDeposit) {
        this.originalDeposit = originalDeposit;
    }

    public List<QueryCouponUesdDTO> getQueryAuthCodes() {
        return queryAuthCodes;
    }

    public void setQueryAuthCodes(List<QueryCouponUesdDTO> queryAuthCodes) {
        this.queryAuthCodes = queryAuthCodes;
    }

    public List<UserFileDTO> getHistoryFiles() {
        return historyFiles;
    }

    public void setHistoryFiles(List<UserFileDTO> historyFiles) {
        this.historyFiles = historyFiles;
    }

    public Boolean getLatestVersion() {
        return latestVersion;
    }

    public void setLatestVersion(Boolean latestVersion) {
        this.latestVersion = latestVersion;
    }

    public String getCardAccount() {
        return cardAccount;
    }

    public void setCardAccount(String cardAccount) {
        this.cardAccount = cardAccount;
    }

    public String getCardUserName() {
        return cardUserName;
    }

    public void setCardUserName(String cardUserName) {
        this.cardUserName = cardUserName;
    }

    public String getBankName() {
        return bankName;
    }

    public void setBankName(String bankName) {
        this.bankName = bankName;
    }

    public String getBankBrname() {
        return bankBrname;
    }

    public void setBankBrname(String bankBrname) {
        this.bankBrname = bankBrname;
    }

    public String getCardNo() {
        return cardNo;
    }

    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }

    public String getCardCellPhone() {
        return cardCellPhone;
    }

    public void setCardCellPhone(String cardCellPhone) {
        this.cardCellPhone = cardCellPhone;
    }

    public CustomerCardDTO getCustomerCardDTO() {
        return customerCardDTO;
    }

    public void setCustomerCardDTO(CustomerCardDTO customerCardDTO) {
        this.customerCardDTO = customerCardDTO;
    }

    public static CustomerCard convertDTOtoCustomerCard(DepositDTO objCts) {
        CustomerCard customerCard = new CustomerCard();
        customerCard.setBankBrname(objCts.getBankBrname());
        customerCard.setBankName(objCts.getBankName());
        customerCard.setCardNo(objCts.getCardNo());
        customerCard.setCardUserName(objCts.getCardUserName());
        customerCard.setSourceType(LandeaConstants.QueryUesdCodeType.DEPOSIT);
        customerCard.setUserId(objCts.getUserId());
        customerCard.setCellPhone(objCts.getCardCellPhone());
        customerCard.setCardAccount(objCts.getCardAccount());
        return customerCard;
    }
    public static CustomerCardDTO convertToCustomerCardDto(DepositDTO objCts) {
        CustomerCardDTO customerCard = new CustomerCardDTO();
        customerCard.setBankBrname(objCts.getBankBrname());
        customerCard.setBankName(objCts.getBankName());
        customerCard.setCardNo(objCts.getCardNo());
        customerCard.setCardUserName(objCts.getCardUserName());
        customerCard.setCellPhone(objCts.getCardCellPhone());
        customerCard.setCardAccount(objCts.getCardAccount());
        return customerCard;
    }

}
